<section data-page="contract-verification-choose-type" class="container new-smart-contract-container">
  <%= render BlockScoutWeb.CommonComponentsView, "_channel_disconnected_message.html", text: gettext("Connection Lost") %>

  <div class="new-smart-contract-form">
      <h1 class="smart-contract-title"><%= gettext "New Smart Contract Verification" %></h1>

      <%= form_for @changeset,
          address_contract_verification_path(@conn, :create),
          [],
          fn f -> %>

        <%= render BlockScoutWeb.AddressContractVerificationCommonFieldsView, "_contract_address_field.html", f: f %>

        <div class="smart-contract-form-group">
          <div class="smart-contract-form-group-inner-wrapper">
            <%= label f, "Verify" %>
            <div class="center-column">
              <div class="form-radios-group vertical">
                <div class="radio-big mb-3">
                  <%= radio_button f, :verify_via, true, checked: true, class: "form-check-input verify-via-flattened-code", "aria-describedby": "verify_via-help-block" %>
                  <div class="radio-icon"></div>
                  <%= label :verify_via, :true, gettext("Via flattened source code"), class: "radio-text" %>
                </div>
                <div class="radio-big">
                  <%= radio_button f, :verify_via, false, class: "form-check-input verify-via-standard-json-input" %>
                  <div class="radio-icon"></div>
                  <%= label :verify_via, :false, gettext("Via Standard Input JSON"), class: "radio-text" %>
                </div>
                <%= if Application.get_env(:explorer, Explorer.ThirdPartyIntegrations.Sourcify)[:enabled] do %>
                  <div class="radio-big">
                    <%= radio_button f, :verify_via, false, class: "form-check-input verify-via-sourcify" %>
                    <div class="radio-icon"></div>
                    <%= label :verify_via, :false, gettext("Via Sourcify: Sources and metadata JSON file"), class: "radio-text" %>
                  </div>
                <% end %>
                <%= if RustVerifierInterface.enabled?() do %>
                  <div class="radio-big">
                    <%= radio_button f, :verify_via, false, class: "form-check-input verify-via-multi-part-files" %>
                    <div class="radio-icon"></div>
                    <%= label :verify_via, :false, gettext("Via multi-part files"), class: "radio-text" %>
                  </div>
                <% end %>
                <div class="radio-big">
                  <%= radio_button f, :verify_via, false, class: "form-check-input verify-vyper-contract" %>
                  <div class="radio-icon"></div>
                  <%= label :verify_via, :false, gettext("Vyper contract"), class: "radio-text" %>
                </div>
              </div>
              <%= error_tag f, :verify_via, id: "verify_via-help-block", class: "text-danger form-error" %>
            </div>
            <div class="smart-contract-form-group-tooltip">Choose a smart-contract verification method. Currently, Blockscout supports 2 methods:<br/>
            1. Verification through flattened source code. <span
                      data-toggle="tooltip"
                      data-placement="top"
                      data-html="true"
                      data-template="<div class='tooltip' role='tooltip'><div class='arrow'></div><div class='tooltip-inner'></div></div>"
                      title="If using a flat file for contract verification, you can use the POA Solidity flattener or the Truffle flattener">
                      <i style="color: #f7b32b;" class="fa fa-info-circle ml-1" data-test="token-bridge-supply"></i></span><br/>
            2. Verification using <a href="https://docs.soliditylang.org/en/latest/using-the-compiler.html#input-description">Standard input JSON</a> file.<br/>
            3. Verification through <a href="https://sourcify.dev">Sourcify</a>.<br/>
              a) if smart-contract already verified on Sourcify, it will automatically fetch the data from the <a href="https://repo.sourcify.dev">repo</a><br/>
              b) otherwise you will be asked to upload source files and JSON metadata file(s).<br/>
            4. Verification of Vyper contract.
            </div>
              
          </div>
        </div>

        <div class="smart-contract-form-buttons">
          <button
            class="position-absolute w-118 btn-full-primary d-none mr-2"
            disabled="true"
            id="loading"
            name="button"
            type="button"
          >
            <%= render BlockScoutWeb.CommonComponentsView, "_loading_spinner.html", loading_text: gettext("Loading...") %>
          </button>
          <%= link(
            gettext("Next"),
            to: address_verify_contract_via_flattened_code_path(@conn, :new, @address_hash),
            id: "verify_via_flattened_code_button",
            class: "btn-full-primary mr-2",
            "data-button-loading": "animation"
          ) %>
          <%= link(
            gettext("Next"),
            to: address_verify_contract_via_json_path(@conn, :new, @address_hash),
            id: "verify_via_sourcify_button",
            class: "btn-full-primary mr-2",
            style: "display: none;",
            "data-button-loading": "animation"
          ) %>
          <%= link(
            gettext("Next"),
            to: address_verify_vyper_contract_path(@conn, :new, @address_hash),
            id: "verify_vyper_contract_button",
            class: "btn-full-primary mr-2",
            style: "display: none;",
            "data-button-loading": "animation"
          ) %>
          <%= link(
            gettext("Next"),
            to: address_verify_contract_via_standard_json_input_path(@conn, :new, @address_hash),
            id: "verify_via_standard_json_input_button",
            class: "btn-full-primary mr-2",
            style: "display: none;",
            "data-button-loading": "animation"
          ) %>
          <%= link(
            gettext("Next"),
            to: address_verify_contract_via_multi_part_files_path(@conn, :new, @address_hash),
            id: "verify_via_multi_part_files_button",
            class: "btn-full-primary mr-2",
            style: "display: none;",
            "data-button-loading": "animation"
          ) %>
          <%=
            link(
              gettext("Cancel"),
              class: "btn-no-border",
              to: address_contract_path(@conn, :index, @address_hash)
              )
          %>
        </div>
      <% end %>
    </div>
    <script defer data-cfasync="false" src="<%= static_path(@conn, "/js/verification-form.js") %>"></script>
</section>
<script defer data-cfasync="false" src="<%= static_path(@conn, "/js/app.js") %>"></script>
